<?php


namespace App\Http\Requests;

use Illuminate\Contracts\Validation\Validator;
use Illuminate\Http\Exceptions\HttpResponseException;

trait CommonRequest
{
    public function failedValidation(Validator $validator)
    {
        throw (new HttpResponseException(response()->json([
            'code'=>'VALIDATION_ERROR',
            'message' => $validator->errors(),
        ], 422)));
    }

}
